<template>
	<view>
		<qf-image-cropper :width="500" :height="500" :radius="30"
			@crop="handleCrop"></qf-image-cropper>
	</view>
</template>

<script>
	import {
		uploadUrl,
	} from "@/config/url.js";
	// 接口地址
	import {
		realNameAuthInfo,
		updateBaseInfo
	} from '@/config/api.js'
	export default {
		data() {
			return {
				
			}
		},
		methods: {
			handleCrop(e) {
				uni.uploadFile({
					url: uploadUrl, //仅为示例，非真实的接口地址
					filePath: e.tempFilePath,
					method: 'POST',
					name: 'file',
					header: {
						'Client-OS': 'wap',
						'Client-Version': '3.0.0',
						'Sys-Type': 'member',
						'Token': uni.getStorageSync('token') || ''
					},
					success: (res) => {
						let data = JSON.parse(res.data)
						
						uni.showToast({
							title: data.msg,
							mask: true,
							icon: 'none',
						})
						
						updateBaseInfo({avatar:data.data.url}).then(res => {
							this.getBaseInfo();
						})
						
						setTimeout(()=>{
								uni.navigateBack();
						},1500)
						
					}
				});
			
			},
		}
	}
</script>

<style>

</style>
